<template>
  <!--删除确认框-->
  <div>
    <confirm v-model="isShow"
        title="提醒"
        @on-cancel="cancel"
        @on-confirm="deletes"
        >
            <p style="text-align:center;">你删除该书籍?</p>
        </confirm>
  </div>    
</template>

<script>
  import store from '@/store/index'
  export default {
    name: 'home',
    data () {
      return {
        msg: 'Welcome to Your Vue.js App',
        isShow: false,
        del_info: '',
        fun_name: ''
      }
    },
    store,
    mounted: function () {
      var that = this
      this.$parent.$on('show_del_box', function (msg) {
        if (msg.bools) {
          that.isShow = true
          that.del_info = msg.info
          that.fun_name = msg.fun_name
        }
      })
    },
    methods: {
      deletes: function () {
        console.log('执行删除数据')
        // 如果删除成功，...
        var deldata = this.$store.state.is_del
        this.$parent.$emit('del_success', {'code': 0, 'msg': '删除成功', 'del_data': deldata})
        this.isShow = false
      },
      cancel: function () {
        this.isShow = false
      }

    }
  }
</script>


<style scoped>


</style>
